#include "trace.h"
#include "..\clientinterfaces.h"
/******************************
verts[0]        verts[1]
_______________
|				    |
|            		|
|_______________|
verts[3]		verts[2]
******************************/

trace::trace(void)
{
	for (int i=0;i<4;++i)
	{
		m_poly.verts[i].rgba.a=180;
		m_poly.verts[i].rgba.r=50;
		m_poly.verts[i].rgba.g=50;
		m_poly.verts[i].rgba.b=50;
	}
	m_poly.verts[0].u=0.0f;
	m_poly.verts[0].v=0.0f;

	m_poly.verts[1].u=1.0f;
	m_poly.verts[1].v=0.0f;

	m_poly.verts[2].u=1.0f;
	m_poly.verts[2].v=1.0f;

	m_poly.verts[3].u=0.0f;
	m_poly.verts[3].v=1.0f;

}

trace::~trace(void)
{
}

#define TRACE_BASE 100
#define TRACE_ACTOR 155
void trace::revalue( LTVector p1,LTVector p2,LTVector p3,LTVector p4,float power )
{

	m_poly.verts[0].x=p1.x;
	m_poly.verts[0].y=p1.y;
	m_poly.verts[0].z=p1.z;

	m_poly.verts[1].x=p2.x;
	m_poly.verts[1].y=p2.y;
	m_poly.verts[1].z=p2.z;

	m_poly.verts[2].x=p3.x;
	m_poly.verts[2].y=p3.y;
	m_poly.verts[2].z=p3.z;

	m_poly.verts[3].x=p4.x;
	m_poly.verts[3].y=p4.y;
	m_poly.verts[3].z=p4.z;

	for (int i=0;i<4;++i)
	{
		m_poly.verts[i].rgba.a=int(TRACE_BASE+TRACE_ACTOR*power);
	}
}

void trace::render()
{
g_pLTCDrawPrim->DrawPrim(&m_poly);

}
